#pragma once
#include <rclcpp/rclcpp.hpp>

#include <string>
#include <behaviortree_cpp_v3/condition_node.h>
#include <hnurm_interfaces/msg/vision_send_data.hpp>
#include <hnurm_interfaces/msg/vision_recv_data.hpp>




namespace hnurm_behavior_trees {

    class GameStart : public BT::ConditionNode ,public rclcpp::Node{
    public:
    /**
     * @brief A constructor for nav2_behavior_tree::GameStart
     * @param condition_name Name for the XML tag for this node
     * @param conf BT node configuration
     */
    GameStart(
        const std::string & condition_name,
        const BT::NodeConfiguration & conf);

    GameStart() = delete;

    /**
     * @brief The main override required by a BT action
     * @return BT::NodeStatus Status of tick execution
     */
    BT::NodeStatus tick() override;

    /**
     * @brief Creates list of BT ports
     * @return BT::PortsList Containing node-specific ports
     */
    static BT::PortsList providedPorts()
    {
        return {
        };
    }

    private:
    /**
     * @brief Callback function for battery topic
     * @param msg Shared pointer to sensor_msgs::msg::BatteryState message
     */
        void is_game_start_callback(const hnurm_interfaces::msg::VisionRecvData::SharedPtr game_state_);

        rclcpp::Node::SharedPtr node_;
        rclcpp::CallbackGroup::SharedPtr callback_group_;
        rclcpp::executors::SingleThreadedExecutor callback_group_executor_;

        rclcpp::Subscription< hnurm_interfaces::msg::VisionRecvData>::SharedPtr referee_sub_;
        std::string referee_topic;

        bool is_game_start;

    };

} // namespace hnurm_behavior_trees